function updatePasswordHandler() {
	$('#change_pw').click(function() {
		var current_pw = $.trim($('input[name=current_pw]').val());
		var new_pw = $.trim($('input[name=new_pw]').val());
		var new_pw_chk = $.trim($('input[name=new_pw_chk]').val());
		if(!current_pw) {
			alert('You did not provide your current password.');
		} else if(new_pw != new_pw_chk) {
			alert('The passwords do not match!');
		} else if(new_pw.length < 5) {
			alert('The new password is too short!\nPasswords require at least 5 alphanumeric characters.');
		} else {
			var form = $('form#pw_change').get(0);
			var img_anchor = $('p#ajax').get(0);
			//alert($(form).attr('action'));return false;
	    $.ajax({
	      url: 			$(form).attr('action'),
	      type: 		'GET',
	      data: 		$(form).serialize(),
	      cache:		false, // requests aren't cached by users browser
	      dataType:		'html',
	      beforeSend:	function() {
	        $(img_anchor).css({'background-image' : 'url(/images/ajax-loader.gif)'});
	      },// end beforeSend Handler
	      success:		function(data, status, xhr) {
	        $(img_anchor).css({'background-image' : 'url()'});
	        $(':password').val('');
	        $('#pw_msg').html(data);
	      }, // end success callback
	      error:		function(xhr, status, error_thrown) {
	    	$(img_anchor).css({'background-image' : 'url()'});
	    	$('#pw_msg').html("<div id='tech_prob'>Sorry, there has been an error: " + error_thrown + "</div>");
	      }// end error callback
	    });// end ajax
		}
		return false;
	});
}

$(document).ready(function() {
	updatePasswordHandler();
});